/**
 * Created with JetBrainsWebStorm.
 * User: xiongpeng
 * Date: 2017/10/11 0011
 * Time: 上午 10:11
 * Desc: 登陆页
 */
import _ from 'underscore';
import Util from '../../common-component/util/util.js';
import Echarts from 'echarts';
import Table from '../../common-component/table/table.js';
import API from '../../api/Api.js';
import HomePageTpl from './home-page.html';

import "./home-page.scss";

export default function HomePage() {
    $("#app-container").html( HomePageTpl({userName: '用户名XXX'}) );
    $('.home-page').css({height:$('.nav').innerHeight()});
    //初始化echars
    // 基于准备好的dom，初始化echarts实例
    var myChart = Echarts.init(document.getElementById('chars'));
// 绘制图表
    var option = {
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        color:['#6784f0', '#53c29c','#1f8fee','#fbdb80','#fb8b63'],
        legend: {
            orient : 'horizontal',
            x : 'center',
            bottom:0,
            data:['SAP','国美在线','亚马逊','其他渠道','POS']
        },
        series : [
            {
                name: '访问来源',
                type: 'pie',
                radius : '55%',
                center: ['50%', '50%'],
                data:[
                    {value:335, name:'SAP'+'  (30%)'},
                    {value:310, name:'国美在线'},
                    {value:234, name:'亚马逊'},
                    {value:135, name:'其他渠道'},
                    {value:1548, name:'POS'}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };


    myChart.setOption(option);
}
